feat(surface): match Rust v29 typed surface targets#273
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
besmpl
force-pushed
the
besmpl/android-surface-rust-parity
branch
from
July 19, 2026 07:45
594bc79 to
66e1e3a
Compare
This was referenced Jul 19, 2026
besmpl
force-pushed
the
besmpl/android-surface-rust-parity
branch
2 times, most recently
from
July 19, 2026 08:49
7faa7a7 to
d61c215
Compare
besmpl
force-pushed
the
besmpl/android-surface-rust-parity
branch
from
July 23, 2026 19:08
086ecad to
6c51256
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Status
Ready for API/design review at exact head
5b0802a6823eba6372cd11361dd4c37b87f2cac2. The branch is rebased onto current WGPUmain, is conflict-free, and every required check is green. Codecov now reports all modified and coverable lines covered.This PR is intentionally stacked on #268. Please merge #268 first. After #268 is rebased and merged, I will do one final rebase that removes its four Android-owned commits from this branch and leaves only the typed-surface follow-up.
One canonical dependency packaging step also remains before merge: go-webgpu/webgpu#24 is merged at
a801aed7399042e5564ef76fc9f075da5cb70081, but no release contains it yet. CI therefore tests that exact clean canonical source through a temporary workspace. The final rebase should consume the first canonical WebGPU release containing #24; no fork, committedreplace, or committedgo.workis needed.Why
#268 proves the pure-Go Android Vulkan mechanism, but its compatibility entry point still carries two untyped
uintptrvalues. This follow-up maps the public/core/HAL surface seam to Rustwgpuv29.0.3 (4cbe6232b2d7c289b6e1a38416a6ae1461a22e81), following the exact-parity review direction established in #253.Thanks @kolkov for pushing both that parity direction and the minimal host boundary on #268. This implementation follows both: WGPU owns surface creation from a caller-supplied native handle downward; Activity, JNI, packaging, and nativeexport stay in the host.
We are very excited to get this upstream cleanly because our game engine needs Android support, and we are happy to handle the remaining rebase, dependency release update, testing, and review follow-ups. Nothing in this API is engine-specific.
What this adds
SurfaceTargetfor a safe provider sampled once and retained until backend surface teardown;SurfaceTargetUnsafeconstructors for Win32, Xlib, Wayland, Android NDK, Metal, and Web targets;CreateSurfaceFromTargetandCreateSurfaceUnsafe, while preserving the existingCreateSurfaceas a compatibility adapter;hal.SurfaceTargetdiscriminator so backends reject foreign handle kinds before pointer use;rust, and browser implementations; andThe exhaustive exported-symbol and ownership map is in
docs/SURFACE-TARGETS.md.Dependency and merge order
Already merged:
a801aed7399042e5564ef76fc9f075da5cb70081.Remaining sequence:
go-webgpu/webgpurelease containing Intel Vulkan Driver Bug: vkCreateGraphicsPipelines Returns VK_SUCCESS with VK_NULL_HANDLE #24;main;Keeping these concerns separate preserves review history and leaves every merge intermediate cgo-free.
Android 29-36 contract
ANativeWindowreference through surface release; WGPU neither acquires/releases it nor owns Activity lifecycle.Validation
CI run 30037307352 is fully green at the exact head above:
The Android gate uses NDK r29, compiles every package/test and the headless example through both default and
rustimplementations withCGO_ENABLED=0andCGO_ENABLED=1, checks Go/NDK ABI layouts, and audits ELF dependencies. It pins canonical goffi v0.6.1 and the exact clean webgpu#24 merge above.Additional focused local checks passed:
Cross-build and policy proof do not substitute for representative physical-device testing. API 29 and API 36 startup, presentation, rotation, Activity recreation, and repeated native-window replacement remain explicit release-evidence gates rather than merge claims.